// router/index.js
import { createRouter, createWebHistory } from 'vue-router';
import Info from '../views/Info.vue';
import Home from '../views/Home.vue'; // 假设你把 Home.vue 放在 views 目录下
import Settings from '../views/Settings.vue'; // 其他页面
import About from '../views/About.vue';
import System from '../views/System.vue';
import SoftList from '../views/SoftList.vue';
import Installed from '../views/Installed.vue';
import Download from '../views/DownloadPage.vue';

const routes = [
  {
    path: '/',
    redirect: '/info/home'  // 默认重定向到首页
  },
  {
    path: '/info',
    component: Info,
    children: [
      {
        path: 'home',
        component: Home,
        meta: { title: '首页' }
      },
      {
        path: 'software',
        component: SoftList,
        meta: { title: '软件商城' }
      },
      {
        path: 'installed',
        component: Installed,
        meta: { title: '安装的应用' }
      },
      {
        path: 'system',
        component: System,
        meta: { title: '系统信息' }
      },
      {
        path: 'settings',
        component: Settings,
        meta: { title: '设置' }

      },
      {
        path: 'about',
        component: About,
        meta: { title: '关于' }
      }
    ]
  },
  {
    path: '/downloads',
    component: Download,
    meta: { title: '下载' }
  },
  // 添加 404 页面处理
  {
    path: '/:pathMatch(.*)*',
    redirect: '/info/home'
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;